package com.mydistibute.distibutelearn.threadstatus;

import java.util.concurrent.TimeUnit;

/**
 * @author victorydeng
 * @Classname Mytest
 * @Description TODO
 * @Date 2020/5/26 21:07
 * @Created by victorydeng
 */
public class Mytest  implements  Runnable{
    @Override
    public void run() {
        while (!Thread.currentThread().isInterrupted()) {
            try {
                System.out.println(111);
                TimeUnit.SECONDS.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("end");
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(new Mytest());
        t1.start();
        Thread.sleep(1111);
        t1.interrupt();


    }
}
